var sdkSlice = Object.extend(function sdkSliceFn( data){
	if( data.isSlice){
		return data;
	}
	if( typeof data == "string" || data instanceof String){
		data = (function parse( sz){
			var field = [];
			for( var i=0; i<sz.length; i++) {
				field.push( sdkCell(
					rules.cellIDs[i],
					sz[i]==="0"? rules.candidIDs :[sz[i]],
					rules.cellsToHouses[ rules.cellIDs[i]]
				));
			}
			return field;
		})( data);
	}	
	return Object.extend(data,{
		isSlice : true,
		isSolved: function(){
			return this.every(function( cell){
				return cell.isSolved();
			});
		},
		disable: function( candidID, bool){
			return sdkSlice( this.map( function(cell){
				return cell.disable(candidID, bool);
			}));
		},
		swap: function( candidID, bool){
			return sdkSlice(this.map( function(cell){
				return cell.swap( candidID, bool);
			}));
		},
		only: function( candidID, bool){
			return sdkSlice(this.map( function(cell){
				return cell.only( candidID, bool);
			}));
		},
		
		// == FILTER ==
		filterBy: function( callback, context){
			return sdkSlice( this.filter(callback, context).concat());
		},
		
		filterByHouse: function( arg){
			return this.filterBy(function (cell) {
					return cell.isInHouse( arg);
				});
		},
		
		filterByCount: function( arg){
			return this.filterBy( function (cell) {
					return cell.count() === arg;
				});
		},
		
		filterNotCount: function( arg){
			return this.filterBy( function (cell) {
					return cell.count() !== arg;
				});
		},
		
		filterByCandid: function( arg){
			return this.filterBy( function (cell) {
					return cell.contains( arg);
				});
		},
		
		filterByID: function( arg){
			return this.filterBy( function( cell){
					return cell.id === arg;
				});
		},
		
		filterNotID: function(arg){
			return this.filterBy( function( cell){
					return cell.id !== arg;
				});
		}
	});
},{ 
	unique: function( arr){
		var newArr = [],
			ids = {};
			
		for( var i= 0; i< arr.length; i++){
			if( arr[i]!==undefined && !ids[ arr[i].id]){
				newArr.push(arr[i]);
				ids[ arr[i].id]=true;
			}
		}
		return sdkSlice( newArr);
	},
	copy: function( arr){
		return sdkSlice(arr.map(function(cell){return sdkCell.copy(cell);}).concat());
	},
	parse: function parse( sz){
		var field = [];
		for( var i=0; i<sz.length; ++i) {
			field.push( sdkCell(
				rules.cellIDs[i],
				sz[i]==="0"? rules.candidIDs :[sz[i]],
				rules.cellsToHouses[ rules.cellIDs[i]]
			));
		}
		return field;
	}
});